package org.agile2soft.nexoma.core.entities;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name = "AUDIT")
@SuppressWarnings({"serial"})
public class Audit implements java.io.Serializable {

    private AuditId id;

    public Audit() {
    }

    public String toString() {
        return String.format("[Audit %s]",id);
    }

    public Audit(AuditId id) {
        this.id = id;
    }

    @EmbeddedId
    @AttributeOverrides( {
            @AttributeOverride(name = "serviceName", column = @Column(name = "AUD_SERVICE_NAME", nullable = false, length = 100)),
            @AttributeOverride(name = "serviceId", column = @Column(name = "AUD_SERVICE_ID")),
            @AttributeOverride(name = "userLogin", column = @Column(name = "AUD_USER_LOGIN", length = 15)),
            @AttributeOverride(name = "userName", column = @Column(name = "AUD_USER_NAME", nullable = false, length = 100)),
            @AttributeOverride(name = "documentNumber", column = @Column(name = "AUD_DOCUMENT_NUMBER", length = 25)),
            @AttributeOverride(name = "date", column = @Column(name = "AUD_DATE", nullable = false, length = 19)) })
    public AuditId getId() {
        return this.id;
    }

    public void setId(AuditId id) {
        this.id = id;
    }

}
